package realQuestion.didi;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main2 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<String> strings = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            String str = scanner.next();
            strings.add(str);
        }
        List<String> strings1 = find(strings);
        System.out.println(strings1.size());
        for (String a:strings1) {
            System.out.println(a);
        }

    }
    static List<String>  find(List<String>  strings){
        ArrayList<String> result = new ArrayList<>();
        for (String str : strings) {
            for (int i = 0; i < str.length(); i++) {
                String pre = str.substring(0, i);
                String end = str.substring(i);
                if (strings.contains(pre)||strings.contains(end)){
                    result.add(str);
                    break;
                }

            }

        }
        Collections.sort(result);
        return  result;

    }

}
